<template>
  <div>

<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
  <div id="main" style="width: 600px;height:400px;"></div>
  </div>
</template>

<script>
  import * as echarts from 'echarts'
  import _ from 'lodash'
  export default {
    data() {
      return {
        options:  {
  title: {
    text: 'Stacked Area Chart'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      label: {
        backgroundColor: '#6a7985'
      }
    }
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },

  
}
      }
    },
    mounted(){
      
       // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));

       this.$axios.get('reports/type/1')
        .then(res=>{
          console.log(res.data,"sj")
          if(res.meta.status==200){
            var option=_.merge(res.data,this.options)
           console.log(option,'op')
          //   // 使用刚指定的配置项和数据显示图表。
           myChart.setOption(option);
          }
        })
    },
    methods:{
     
    }
  }
</script>

<style scoped>

</style>